spinoff
an easy to use, robust library for displaying spinners in the terminal
π¨ Install
Add as a dependency to your Cargo.toml
:
[]
= "0.8.0"
β‘ Usage
use ;
use sleep;
use Duration;
let mut spinner = new;
sleep;
spinner.success;
Update a spinner
use ;
use sleep;
use Duration;
let mut spinner = new;
sleep;
spinner.update;
sleep;
spinner.stop
Specify an output stream
use ;
use sleep;
use Duration;
let mut spinner = new_with_stream;
sleep;
spinner.stop_and_persist;
π« Spinners
spinoff
includes over 80+ spinner variants out of the box.
All spinner variants are treated as features that can be enabled or disabled. By default, all of them are enabled for ease of use.
To disable/enable variants, you will have to edit your cargo.toml
file:
[]
= { = "0.8.0", = ["dots", "arc", "line"] }
Any suggestions for new spinner variants are welcome.
Creating your own spinner
You can create your own spinner using the spinner!
macro:
use *;
use sleep;
use Duration;
let frames = spinner!;
let mut sp = new;
sleep;
sp.stop;
βNote for Windows Users
For colors to work properly, you need to add a few extra lines to your code:
use control
enable_virtual_terminal.unwrap;
π Documentation
- All relevant documentation can be found on the Docs.rs page.
- If you want to see all the available
spinner
options, refer to thespinner
module.
β Examples
Other examples can be found in the documentation.
π§ Contributing
Any contributions to this crate are highly appreciated. If you have any ideas/suggestions/bug fixes, please open an issue or a pull request. If you like the project, star this project on GitHub.
π License
This crate is licensed under the MIT license.